<script type="text/javascript">

    $("#img_list").on("hidden.bs.modal", function() {
        $(this).removeData("bs.modal");
    });

    $(function () {
        $('.tag_list ul li').click(function () {
            $(".select_li").removeClass('select_li');
            $(this).addClass('select_li');
        })
        $('.tag_lists ul li').click(function () {
            $(".select_lis").removeClass('select_lis');
            $(this).addClass('select_lis');
        })
    })

    function del_img_id(id) {
        if(confirm("确认删除图片吗？")) {
            $.ajax({
                type: 'post',
                url: 'index.php?c=imgList&m=del_img_id',
                data: {"id": id},
                dataType: 'json',
                success: function (data) {
                    if (data.status == 1) {
                        alert(data['msg'])
                        $('#close_<?php echo $id;?>').show();
                        $('#img_del_'+id+'').remove();

                        return;
                    } else {
                        alert(data.msg);
                        return;
                    }
                }

            });
        }
    }
    function check_img(id, path, imgid){
        $("#"+id).val(path);
        //拼团时选图片专用
        $("#img_"+id+"").attr("src",path);
        /////////////////

        $.ajax({
            type:'post',
            url:'index.php?c=post&m=ajax_update_pic',
            data:{"id":id, "img_id":imgid},
            dataType:'json',
            success:function(data){
                if(data.status == 1) {
                   alert('封面图选择成功！')
                    $('#close_<?php echo $id;?>').show();

                    // return;
                }else{
                    alert(data.errorMsg);
                }
            }

        });
        $('#img_list').modal('hide');
        $('#img_list').click();
        $('.close').click();

    }
</script>
<style>
    .img_d{width: 122px;height: 122px; float: left;border: 1px solid #e7eaec;padding: 5px;margin: 5px;}
    .img_d_1{margin-top: 30px;display: block;margin-left: 30px;}
    .img_d_2{margin-top: 35px;display: block;}
</style>
<div class="tab-pane active" id="horizontal-form">

    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h5 class="modal-title"><?php echo $pageTitle;?></h5>
    </div>
<style>
    <!--
    .tag_list,.tag_lists{width: 100%;clear: both;}
    .tag_list a,.tag_lists a{color: #000000;}
    .tag_list ul li,.tag_lists ul li{
        list-style: none;
        float: left;
        /*width: 50px;*/
        border: 1px solid #cccccc;
        margin-left: 3px;
        text-align: center;
        /*height: 25px;*/
        line-height: 25px;
        color: #000000;
        margin-bottom: 5px;
    }
    .select_li,.select_lis{background: #c1d1d7;color: #ff0000;}
    .select_li a,.select_lis a{color: #ff0000; height: 25px;padding: 5px 10px;}
    .tag_list a{height: 25px;padding: 5px 10px;}
    .tag_lists a{height: 25px;padding: 5px 10px;}
    -->
</style>
    <div class="tag_list">
        <ul>

            <li <?php echo $tag_id < 1?" class='select_li'":""?>>
                <a href="javascript:void(0)" onclick="multipage('index.php?c=imgList&m=ajax_img_list&id=<?php echo $id;?>&tag_id=&is_related=<?php echo $is_related;?>&type=<?php echo $type;?>','data_img_list','page_img_list')">全部</a></li>
            <?php
                foreach ($tag as $k=>$v){
            ?>
            <li <?php echo $v['id'] == $tag_id?" class='select_li'":""?>>
                <a href="javascript:void(0)" onclick="multipage('index.php?c=imgList&m=ajax_img_list&id=<?php echo $id;?>&tag_id=<?php echo $v['id'];?>&is_related=<?php echo $is_related;?>&type=<?php echo $type;?>&is_hege=<?php echo $is_hege;?>','data_img_list','page_img_list')"><?php echo $v['title']?></a>
            </li>
            <?php }?>
            <li style="display: none;">
                <a href="javascript:void(0)" onclick="multipage('index.php?c=imgList&m=ajax_img_list&id=<?php echo $id;?>&tag_id=<?php echo $tag_id;?>&is_related=<?php echo $is_related;?>&type=<?php echo $type;?>&is_hege=1','data_img_list','page_img_list')">
                    合格
                </a>
            </li>
            <li style="display: none;">
                <a href="javascript:void(0)" onclick="multipage('index.php?c=imgList&m=ajax_img_list&id=<?php echo $id;?>&tag_id=<?php echo $tag_id;?>&is_related=<?php echo $is_related;?>&type=<?php echo $type;?>&is_hege=2','data_img_list','page_img_list')">
                    不合格
                </a>
            </li>
        </ul>
<div style="width: 100%;clear: both;height: 5px; border-bottom: 1px solid #cccccc;"></div>
    </div>
    <style>
        <!--
        .close_del{opacity:0.99;background: #ffffff;color: red; border: 0px; float:right; position:fixed;}
        .img_he{ width: 50px;height: 30px;color: red;background: #c8c8c8;position:fixed;margin-top: 80px;line-height: 30px;}
        -->
    </style>
    <div class="img_list"  id="data_img_list">

        <?php
        foreach($list as $img){
            $w=$img['w']>$img['h']?110:'';
            $h=$img['h']>$img['w']?110:'';
            $w=$img['w']==$img['h']?110:$w;
            ?>
            <div class="img_d" style="text-align: center;" id="img_del_<?php echo $img['id']?>">
                <button type="button" class="close_del" aria-label="Close" style="" onclick="del_img_id(<?php echo $img['id']?>)"><span aria-hidden="true">&times;</span></button>
                <a   onclick="check_img('<?php echo $id;?>','<?php echo $img["path"];?>?x-oss-process=style/scale-cade2','<?php echo $img["id"];?>')" class="<?php echo $cls;?>"  style="line-height:120px;" <?php echo ' title="宽'.$img['w'].'px,高'.$img['h'].'px,大小'.intval((intval($img['size'])/1024)).'kb"';?>>
                    <div class="img_he"><?php echo $img['w']<720?'不合格':($img['h']<720?'不合格':($img['size']<20480?'不合格':'合格'))?></div>
                    <img src="<?php echo $img["path"];?>?x-oss-process=style/scale-cade2" width="<?php echo $w;?>" height="<?php echo $h;?>" style="display: inline-block; vertical-align: middle;">
                </a>
            </div>
        <?php } ?>
        <div class="clearfix"></div>
    </div>
    <div id="page_img_list">
        <?php echo $multipage;?>
        <div class="clearfix" onclick="multipage()"></div>
    </div>
</div>
